<ul>
<?php
// lists existing links, not orphans... grr
foreach($db->links->link as $link) {
  $pagewanted = $link['to'];
  $pagelinking = $link['from'];
  $wantedpageexists = false;
  foreach($db->pages->page as $page) {
    if($page['title'] == $pagewanted) {
      $wantedpageexists = true;
      exit;
    }
  }
  if(!$wantedpageexists) {
    echo "<li><a href='?edit=$pagewanted'>$pagewanted</a> wanted by
    <a href='?show=$pagelinking'>$pagelinking</a>";
  }
}
?>
</ul>